import { REGEX_CHINESE } from '@/utils/validate'

const rules = {
  storeName: [
    {
      required: true,
      message: '请输入门店名称',
      trigger: 'blur'
    },
    {
      max: 50,
      message: '门店名称不可超过40个字符'
    }
  ],
  contactName: [
    {
      max: 10,
      message: '联系人姓名不可超过10个字符',
      trigger: 'blur'
    },
    {
      pattern: REGEX_CHINESE,
      message: '请输入中文'
    }
  ],
  address: [
    {
      max: 60,
      message: '联系人地址不可超过60个字符',
      trigger: 'blur'
    }
  ],
  storeType: [
    {
      required: true,
      message: '请选择门店类型',
      trigger: 'change'
    }
  ],
  contactPhone: [
    {
      pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
      message: '请输入正确的手机号码',
      trigger: 'blur'
    }
  ],
  sort: [
    {
      required: true,
      message: '请输入排序位置',
      trigger: 'blur'
    },
    {
      pattern: /^[1-9]\d{0,3}$/,
      message: '请输入1-9999'
    }
  ]
}

export default rules
